home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 34 / Amiga Format CD34 (1998-11-20)(Future Publishing)(GB)[!][Christmas issue].iso / -seriously_amiga- / programming / c / viewperf5.1 / viewperf / objs / qadf.c < prev    next >
C/C++ Source or Header  |  1998-10-01  |  24KB  |  555 lines

  1. #ifdef WIN32
  2. #include <windows.h>
  3. #endif
  4. #include <GL/gl.h>
  5. #include "viewperf.h"
  6. #include "vpDefine.h"
  7.  
  8. void FUNCTION(struct ThreadBlock *tb) {
  9.         int polyi,verti;
  10.     int numverts;
  11.     int polycount = tb->np;
  12. #ifdef BATCH
  13.     int groupi;
  14.     int batchi;
  15.     int leftoveri;
  16.     int batchcount = tb->batchnum;
  17.     int groupcount = tb->batchgroups;
  18.     int leftovercount = tb->batchleftovers;
  19. #endif
  20.     int *vertindex;
  21.         GLenum mode = tb->mode;
  22. #ifdef EXTERNAL
  23.         GLenum capability = tb->capability;
  24.         void (*lExternfunc)(GLenum) = tb->externfunc;
  25. #endif
  26.  
  27. #ifdef BY_TWO
  28.     int *startvertindex;
  29. #endif
  30.  
  31.     struct vector *pvert=tb->vert;
  32.     struct plygon *pply=tb->ply;
  33.  
  34. #ifndef FUNCTION_CALLS
  35. #ifdef WIN32
  36.         void (APIENTRY *glVertex3fvP)(const GLfloat *);
  37. #else
  38.         void (*glVertex3fvP)(const GLfloat *);
  39. #endif
  40. #endif 
  41.  
  42. #if defined(FACET_NORM) || defined(VERT_NORM)
  43.     struct vector *pvnorm=tb->vnorm;
  44. #ifndef FUNCTION_CALLS
  45. #ifdef WIN32
  46.         void (APIENTRY *glNormal3fvP)(const GLfloat *);
  47. #else
  48.         void (*glNormal3fvP)(const GLfloat *);
  49. #endif
  50. #endif /* ifndef FUNCTION_CALLS */
  51. #endif
  52.  
  53. #if defined(FACET_COLOR) || defined(VERT_COLOR)
  54.     struct colorvector *pvcolor=tb->vcolor;
  55. #ifndef FUNCTION_CALLS
  56. #ifdef WIN32
  57.         void (APIENTRY *glColorP)(const GLfloat *);
  58. #else
  59.         void (*glColorP)(const GLfloat *);
  60. #endif
  61. #endif  /* ifndef FUNCTION_CALLS */
  62. #endif
  63.  
  64. #ifdef TEXTURE
  65.     struct vector *ptexture=tb->texture;
  66. #ifndef FUNCTION_CALLS
  67. #ifdef WIN32
  68.         void (APIENTRY *glTexCoord2fvP)(const GLfloat *);
  69. #else
  70.         void (*glTexCoord2fvP)(const GLfloat *);
  71. #endif
  72. #endif /* ifndef FUNCTION_CALLS */
  73. #endif
  74.  
  75. #ifndef FUNCTION_CALLS
  76. #ifdef TEXTURE
  77.         glTexCoord2fvP = glTexCoord2fv;
  78. #endif
  79. #if defined(FACET_COLOR) || defined(VERT_COLOR)
  80.         glColorP = tb->ColorP;
  81. #endif
  82. #if defined(FACET_NORM) || defined(VERT_NORM)
  83.         glNormal3fvP = glNormal3fv;
  84. #endif
  85.         glVertex3fvP = glVertex3fv;
  86. #endif  
  87.  
  88.  
  89. #ifdef BATCH
  90.     polyi = polycount;
  91.         for(groupi=groupcount-1;groupi>=0;groupi--) {
  92.             glBegin(mode);
  93.             for(batchi=batchcount-1;batchi>=0;batchi--) {
  94.         polyi--;
  95. #else
  96.         for(polyi=polycount-1;polyi>=0;polyi--) {
  97. #endif
  98.         numverts = pply[polyi].numverts;
  99.         vertindex = pply[polyi].index;
  100. #ifdef BY_TWO
  101.         startvertindex = vertindex;
  102. #endif
  103. #ifdef EXTERNAL
  104.                 lExternfunc(capability);
  105. #endif
  106. #if    defined(FACET_COLOR) && !defined(FUNCTION_CALLS)
  107.                 (*glColorP)((const GLfloat *) (pvcolor + *vertindex));
  108. #elif  defined(FACET_COLOR) &&  defined(FUNCTION_CALLS) && !defined(COLOR4)
  109.                 glColor3fv((const GLfloat *) (pvcolor + *vertindex));
  110. #elif  defined(FACET_COLOR) &&  defined(FUNCTION_CALLS) &&  defined(COLOR4)
  111.                 glColor4fv((const GLfloat *) (pvcolor + *vertindex));
  112. #endif
  113. #if    defined(FACET_NORM) && !defined(FUNCTION_CALLS)
  114.                 (*glNormal3fvP)((const GLfloat *) (pvnorm + *vertindex));
  115. #elif  defined(FACET_NORM) &&  defined(FUNCTION_CALLS)
  116.                 glNormal3fv((const GLfloat *) (pvnorm + *vertindex));
  117. #endif
  118. #ifndef BATCH
  119.                 glBegin(mode);
  120. #endif
  121. #if    defined(VERT_COLOR) && !defined(FUNCTION_CALLS)
  122.                     (*glColorP)((const GLfloat *) (pvcolor + *vertindex));
  123. #elif  defined(VERT_COLOR) &&  defined(FUNCTION_CALLS) && !defined(COLOR4)
  124.                     glColor3fv((const GLfloat *) (pvcolor + *vertindex));
  125. #elif  defined(VERT_COLOR) &&  defined(FUNCTION_CALLS) &&  defined(COLOR4)
  126.                     glColor4fv((const GLfloat *) (pvcolor + *vertindex));
  127. #endif
  128. #if    defined(TEXTURE) && !defined(FUNCTION_CALLS)
  129.                         (*glTexCoord2fvP)((const GLfloat *) (ptexture + *vertindex));
  130. #elif  defined(TEXTURE) &&  defined(FUNCTION_CALLS)
  131.                         glTexCoord2fv((const GLfloat *) (ptexture + *vertindex));
  132. #endif
  133. #if    defined(VERT_NORM) && !defined(FUNCTION_CALLS)
  134.                         (*glNormal3fvP)((const GLfloat *) (pvnorm + *vertindex));
  135. #elif  defined(VERT_NORM) &&  defined(FUNCTION_CALLS)
  136.                         glNormal3fv((const GLfloat *) (pvnorm + *vertindex));
  137. #endif
  138. #ifdef FUNCTION_CALLS
  139.                         glVertex3fv((const GLfloat *) (pvert + *vertindex));
  140. #else
  141.                         (*glVertex3fvP)((const GLfloat *) (pvert + *vertindex));
  142. #endif
  143.  
  144. #ifdef BY_TWO
  145.             vertindex++;
  146.   #if    defined(VERT_COLOR) && !defined(FUNCTION_CALLS)
  147.                     (*glColorP)((const GLfloat *) (pvcolor + *vertindex));
  148.   #elif  defined(VERT_COLOR) &&  defined(FUNCTION_CALLS) && !defined(COLOR4) 
  149.                     glColor3fv((const GLfloat *) (pvcolor + *vertindex));
  150.   #elif  defined(VERT_COLOR) &&  defined(FUNCTION_CALLS) &&  defined(COLOR4) 
  151.                     glColor4fv((const GLfloat *) (pvcolor + *vertindex));
  152.   #endif
  153.   #if    defined(TEXTURE) && !defined(FUNCTION_CALLS)
  154.                         (*glTexCoord2fvP)((const GLfloat *) (ptexture + *vertindex));
  155.   #elif  defined(TEXTURE) &&  defined(FUNCTION_CALLS)
  156.                         glTexCoord2fv((const GLfloat *) (ptexture + *vertindex));
  157.   #endif
  158.   #if    defined(VERT_NORM) && !defined(FUNCTION_CALLS)
  159.                         (*glNormal3fvP)((const GLfloat *) (pvnorm + *vertindex));
  160.   #elif  defined(VERT_NORM) &&  defined(FUNCTION_CALLS)
  161.                         glNormal3fv((const GLfloat *) (pvnorm + *vertindex));
  162.   #endif
  163.   #ifdef FUNCTION_CALLS
  164.                         glVertex3fv((const GLfloat *) (pvert + *vertindex));
  165.   #else
  166.                         (*glVertex3fvP)((const GLfloat *) (pvert + *vertindex));
  167.   #endif
  168. #else
  169.             vertindex++;
  170. #endif
  171.  
  172. #if    defined(VERT_COLOR) && !defined(FUNCTION_CALLS)
  173.                     (*glColorP)((const GLfloat *) (pvcolor + *vertindex));
  174. #elif  defined(VERT_COLOR) &&  defined(FUNCTION_CALLS) && !defined(COLOR4)
  175.                     glColor3fv((const GLfloat *) (pvcolor + *vertindex));
  176. #elif  defined(VERT_COLOR) &&  defined(FUNCTION_CALLS) &&  defined(COLOR4)
  177.                     glColor4fv((const GLfloat *) (pvcolor + *vertindex));
  178. #endif
  179. #if    defined(TEXTURE) && !defined(FUNCTION_CALLS)
  180.                         (*glTexCoord2fvP)((const GLfloat *) (ptexture + *vertindex));
  181. #elif  defined(TEXTURE) &&  defined(FUNCTION_CALLS)
  182.                         glTexCoord2fv((const GLfloat *) (ptexture + *vertindex));
  183. #endif
  184. #if    defined(VERT_NORM) && !defined(FUNCTION_CALLS)
  185.                         (*glNormal3fvP)((const GLfloat *) (pvnorm + *vertindex));
  186. #elif  defined(VERT_NORM) &&  defined(FUNCTION_CALLS)
  187.                         glNormal3fv((const GLfloat *) (pvnorm + *vertindex));
  188. #endif
  189. #ifdef FUNCTION_CALLS
  190.                         glVertex3fv((const GLfloat *) (pvert + *vertindex));
  191. #else
  192.                         (*glVertex3fvP)((const GLfloat *) (pvert + *vertindex));
  193. #endif
  194.  
  195. #ifdef BY_TWO
  196.             vertindex++;
  197.   #if    defined(VERT_COLOR) && !defined(FUNCTION_CALLS)
  198.                         (*glColorP)((const GLfloat *) (pvcolor + *vertindex));
  199.   #elif  defined(VERT_COLOR) &&  defined(FUNCTION_CALLS) && !defined(COLOR4)
  200.                         glColor3fv((const GLfloat *) (pvcolor + *vertindex));
  201.   #elif  defined(VERT_COLOR) &&  defined(FUNCTION_CALLS) &&  defined(COLOR4)
  202.                         glColor4fv((const GLfloat *) (pvcolor + *vertindex));
  203.   #endif
  204.   #if    defined(TEXTURE) && !defined(FUNCTION_CALLS)
  205.                         (*glTexCoord2fvP)((const GLfloat *) (ptexture + *vertindex));
  206.   #elif  defined(TEXTURE) &&  defined(FUNCTION_CALLS)
  207.                         glTexCoord2fv((const GLfloat *) (ptexture + *vertindex));
  208.   #endif
  209.   #if    defined(VERT_NORM) && !defined(FUNCTION_CALLS)
  210.                         (*glNormal3fvP)((const GLfloat *) (pvnorm + *vertindex));
  211.   #elif  defined(VERT_NORM) &&  defined(FUNCTION_CALLS)
  212.                         glNormal3fv((const GLfloat *) (pvnorm + *vertindex));
  213.   #endif
  214.   #ifdef FUNCTION_CALLS
  215.                         glVertex3fv((const GLfloat *) (pvert + *vertindex));
  216.   #else
  217.                         (*glVertex3fvP)((const GLfloat *) (pvert + *vertindex));
  218.   #endif
  219. #else
  220.             vertindex++;
  221. #endif
  222.  
  223. #if    defined(VERT_COLOR) && !defined(FUNCTION_CALLS)
  224.                         (*glColorP)((const GLfloat *) (pvcolor + *vertindex));
  225. #elif  defined(VERT_COLOR) &&  defined(FUNCTION_CALLS) && !defined(COLOR4)
  226.